<ion-header>
  <ion-navbar color="primary">
    <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>Downloaded stuffs</ion-title>
    <ion-buttons end *ngIf="!selectionEnabled">
      <button ion-button icon-only (click)="enableSelection()">
        <ion-icon name="done-all"></ion-icon>
      </button>
    </ion-buttons>
    <ion-buttons end *ngIf="selectionEnabled">
      <button ion-button icon-only (click)="disableSelection()">
        <ion-icon name="undo"></ion-icon>
      </button>
      <button ion-button icon-only (click)="delete()" [disabled]="noneSelected">
        <ion-icon name="trash"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>
</ion-header>

<ion-content>
  <ion-list *ngIf="novels.length">
    <ion-list-header>
      Novels
    </ion-list-header>
    <button ion-item *ngFor="let novel of novels" (click)="openNovel(novel)">
      <ion-checkbox [checked]="isInList(novel, selectedNovels)" (click)="openNovel(novel)" *ngIf="selectionEnabled"></ion-checkbox>      
      <ion-thumbnail item-start>
        <img [ln-img-src]="novel.cover" alt="Cover">
      </ion-thumbnail>
      <ion-label>
        <h2>{{novel.title}}</h2>
        <span>{{novel.author}}</span>
      </ion-label>
    </button>
  </ion-list>

  <ion-list *ngIf="epubs.length">
    <ion-list-header>
      Exported to Epub
    </ion-list-header>
    <button ion-item *ngFor="let epub of epubs" (click)="openEpub(epub)">
      <ion-checkbox [checked]="isInList(epub, selectedEpubs)" (click)="openEpub(epub)" *ngIf="selectionEnabled"></ion-checkbox>
      <ion-thumbnail item-start>
        <img [ln-img-src]="epub.cover" alt="Cover">
      </ion-thumbnail>
      <ion-label>
        <h2>{{epub.title}}</h2>
        <span>{{epub.author}}</span>
      </ion-label>
    </button>
  </ion-list>
</ion-content>